
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>新闻首页</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="jquery-3.3.1.min.js"> </script>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="navbar-form">
                <form>
                    <div class="form-group">
                        <input type="text" name="key" class="form-control" />
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>

                <%--不需要后台处理，所以直接链接--%>
                <a href="addNews.jsp"><button  class="btn btn-info">添加新闻</button></a>

                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>
                            标题
                        </th>
                        <th>
                            发布者
                        </th>
                        <th>
                            发布时间
                        </th>
                        <th>
                            新闻内容
                        </th>
                        <th>
                            操作
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="item" items="${requestScope.list}">

                        <tr >
                            <td>
                                <a href="Info?id=${item.id}">${item.title}</a>
                            </td>
                            <td>
                                    ${item.author}
                            </td>
                            <td>
                                    ${item.time}
                            </td>
                            <%--width: 150px; //设置需要固定的宽度white-space: nowrap; //不换行text-overflow: ellipsis; //超出部分用....代替overflow: hidden; //超出隐藏--%>
                            <td>
                                   <div  style="height: 20px;  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;">
                                           ${item.content}
                                   </div>
                            </td>
                            <td>
                                <a href="upData?id=${item.id}">修改</a>
                                <a href="delete?id=${item.id}">删除</a>
                            </td>
                        </tr>

                    </c:forEach>
                    </tbody>
                </table>

            </div>



        </div>
    </div>
</div>

</body>
</html>